
/**********************************************************************************\
** 文件名称: RGB.h
** 创建人员: YCG
** 创建日期: 2018-11-30
** 文档描述:
** 版本代号: V0.1
** 版本说明: 初始版本
\********************************************************************************/
#ifndef __R_G_B_H_
#define __R_G_B_H_
#include "main.h"

#define  RGB_DEBUG
#ifdef  RGB_DEBUG
#include "uart.h"
#define  RGB_Printf(fmt,...)   Uprintf(fmt,__VA_ARGS__)
#else
#define  RGB_Printf(...)
#endif

#define RGB_MAX_NUM   10          //最大灯的数量
#define RGB_START_NUM 4           //起始低电平的数量
#define RGB_END_NUM   4           //结束低电平的数量，建议不要小于4

#define RGB_SPI_BUF_NUM   (12*RGB_MAX_NUM+RGB_START_NUM+RGB_END_NUM)    //SPI发送缓存的大小

#define RGB_CLOSE        0  //关闭所有的灯
#define RGB_NO_BLINK     1  //正常显示，灯的颜色不随时间变化
#define RGB_RAINBOW      2   //渐变，彩虹效果
#define RGB_RAINBOW_AVR  3   //渐变，彩虹效果，颜色均匀分布
#define RGB_BLN          4   //渐变，彩虹效果，颜色均匀分布

#define Delay LL_mDelay    

typedef struct _RGB_TypeDef
{
    uint8_t green;       //按灯的颜色的发送顺序排列
    uint8_t red;
    uint8_t blue;
} RGB_TypeDef;

void RGB_Init(uint8_t num);
void RGB_Update(void);
void RGB_Scan( uint32_t time);
void RGB_Set(uint8_t mode, uint8_t intensity, uint16_t time);
void RGB_Set8Color(uint8_t num,  uint8_t r, uint8_t g, uint8_t b);
void RGB_SetAllColor( uint8_t r, uint8_t g, uint8_t b);
void Wheel(uint8_t num,uint8_t intensity,uint8_t color);

//void RGB_Set8Color(uint8_t num, uint8_t r, uint8_t g, uint8_t b);
//void RGB_Set32Color(uint8_t num, uint32_t color);
//void RGB_SetOneColor(uint8_t num, uint32_t color) ;
//void RGB_SetAllColor(uint8_t r, uint8_t g, uint8_t b);
//uint32_t RGB_Color(uint8_t r, uint8_t g, uint8_t b);
////uint32_t Wheel(uint8_t WheelPos);
//void rainbow(uint16_t wait);
//void rainbowCycle(uint16_t wait);
//void theaterChase(uint32_t c, uint16_t wait);
//void theaterChaseRainbow(uint16_t wait);
//void colorWipe(uint32_t c, uint16_t wait);
//void RGB_Test(void);
#endif

/********************************End of File************************************/
